package demo.hello;

import java.io.File;

public class DeleteDirs {

	public static void main(String[] args) {
		// TODO �Զ����ɵķ������
		File dir = new File("d:\\sublime\\test");
		delete(dir);
	}

	public static void delete(File dir) {
		File[] files = dir.listFiles();
		if (files.length == 0) {
			dir.delete();
			return;
		} else
			for (File file : files) {
				if (file.isDirectory())
					delete(file);
			}
		File[] newFiles = dir.listFiles();
		if (newFiles.length == 0)
			dir.delete();
	}

}
